export default {
  name: 'distribute',
  namespaced: true,
  state: {
    distributeForm: {
      title: '',
      content: '',
      contentType: '',
      fileIds: []
    }
  },
  actions: {
    setDistributeForm(content, distributeForm) {
      content.commit('SET_TITLE', distributeForm.title)
      content.commit('SET_CONTENT', distributeForm.content)
      content.commit('SET_FILEIDS', distributeForm.fileIds)
      content.commit('SET_CONTENTTYPE', distributeForm.contentType)
    }
  },
  mutations: {
    SET_TITLE: (state, title) => {
      state.distributeForm.title = title
    },
    SET_CONTENT: (state, content) => {
      state.distributeForm.content = content
    },
    SET_FILEIDS: (state, fileIds) => {
      state.distributeForm.fileIds = fileIds
    },
    SET_CONTENTTYPE: (state, contentType) => {
      state.distributeForm.contentType = contentType
    },
    RESET_DISTRIBUTEFORM: (state) => {
      state.distributeForm = {
        title: '',
        content: '',
        contentType: '',
        fileIds: []
      }
    }
  }

}
